@extends('admin.main')
@section('content')
    <div class="admin-content">
        <div class="admin-content-body">
            <div class="am-cf am-padding am-padding-bottom-0">
                <div class="am-fl am-cf">
                    <strong class="am-text-primary am-text-lg">后台设置</strong>
                    /
                    <strong class="am-text-primary am-text-lg">岗位层级</strong>
                    {{--/ <small></small>--}}
                </div>
            </div>
            <hr>
            <div class="am-g">
                <div class="am-u-sm-12 am-u-md-6">
                    {{--<div class="am-btn-toolbar">--}}
                        {{--<div class="am-btn-group am-btn-group-xs">--}}
                            {{--<a href="#">--}}
                                {{--<button type="button" class="am-btn am-btn-default">--}}
                                    {{--<span class="am-icon-file"></span>--}}
                                    {{--后台设置--}}
                                {{--</button>--}}
                            {{--</a>--}}
                        {{--</div>--}}
                    {{--</div>--}}
                    {{--<select onchange="getParent(this.value)"--}}
                            {{--style="padding:2px 10px;background:0;border:1px solid #f0f0f0;">--}}
                        {{--@foreach($parents as $k=>$parent)--}}
                        {{--<option value="{{$k}}" {{$pid==$k?'selected':''}}--}}
                            {{-->{{$parent}}</option>--}}
                        {{--@endforeach--}}
                    {{--</select>--}}
                    {{--<script>--}}
                        {{--function getParent(v){--}}
                            {{--if (v==0) {--}}
                                {{--window.location.href = '{{$prefix_url}}';--}}
                            {{--} else {--}}
                                {{--window.location.href = '{{$prefix_url}}/?pid='+v;--}}
                            {{--}--}}
                        {{--}--}}
                    {{--</script>--}}
                </div>
            </div>

            <div class="am-g">
                <div class="am-panel am-panel-default" style="margin:20px;">
                    <div class="am-panel-hd">岗位层级
                        <div class="am-btn-group am-btn-group-xs am-fr">
                            <a href="{{$prefix_url}}/create" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-plus"></span> 添加</a>
                        </div>
                    </div>
                    @if(count($datas))
                        @foreach($datas as $data)
                    <div class="am-panel-bd">
                        <div class="am-g">
                            <div class="am-u-md-12">
                                <div class="am-panel am-panel-default" style="
                                        height:{{ceil(count($data->subs)/3)*80+40}}px;
                                        ">
                                    <div class="am-panel-hd">
                                        <a href="javascript:;" title="{{$data->id}}">
                                            {{$data->name}}
                                        </a>
                                        <div class="am-btn-group am-btn-group-xs am-fr">
                                            <div class="am-btn-group am-btn-group-xs am-fr">
                                                {{--<a href="" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-plus"></span> 添加</a>--}}
                                                <a href="{{$prefix_url}}/{{$data->id}}/edit" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-plus"></span> 编辑</a>
                                                {{--<button type="button" class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="window.location.href='{{$prefix_url}}/del/{{$data->id}}';"><span class="am-icon-trash-o"></span> 删除</button>--}}
                                            </div>
                                        </div>
                                    </div>
                                    <br>
                                    @if($subs=$data->subJobs)
                                        @foreach($subs as $sub)
                                        <div class="am-u-md-4 am-u-end">
                                            <div class="am-panel am-panel-default">
                                                <div class="am-panel-hd">
                                                    <a href="{{$prefix_url}}/{{$sub->id}}" title="详情查看{{$sub->id}}">{{mb_strlen($sub->name)>4?mb_substr($sub->name,0,4).'...':$sub->name}}</a>
                                                    <div class="am-btn-group am-btn-group-xs am-fr">
                                                        {{--<a href="" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-plus"></span> 添加</a>--}}
                                                        <a href="{{$prefix_url}}/{{$sub->id}}/edit" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-edit"></span> 编辑</a>
                                                        {{--<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="window.location.href='{{$prefix_url}}/del/{{$sub->id}}';"><span class="am-icon-trash-o"></span> 删除</button>--}}
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        @endforeach
                                    @endif
                                </div>
                            </div>
                        </div>
                    </div>
                        @endforeach
                    @endif
                </div>
            </div>
        </div>
    </div>
@stop